export default {
    mounted() {
        let that = this;
        this.createContextMenu(that);
        this.map.on("rightclick", e => {
            that.openContextMenu(e)
        })
    },
    methods: {
        /**
         * 创建右键菜单
         */
        createContextMenu(that) {
            this.contextMenu = new AMap.ContextMenu({
                isCustom: true,
            })
            this.contextMenu.addItem("<p>返回</p>", () => {
                that.map.setCenter(that.center)
                that.map.setZoom(that.zoom)
                that.reRenderAreaNode();
            })
        },
        /**
         * 打开右键菜单
         * @param e
         */
        openContextMenu(e) {
            this.contextMenu.open(this.map, e.lnglat)
        }
    }
}